Azure OpenAI API (preview:2024-04-01)

2025/03/21 • 2 updated methods

GetChatCompletions (updated)
Description Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
Reference Link ¶

⚶ Changes

{
  "#id": "GetChatCompletions",
  "$responses": {
    "200": {
      "$properties": [
        {
          "#name": "usage",
          "Required": {
            "new": false,
            "old": true
          }
        }
      ]
    }
  }
}

⚼ Request

POST:  /deployments/{deploymentId}/chat/completions
{
api-version: string ,
deploymentId: string ,
body:
{
messages:
[
{
role: enum ,
}
,
]
,
functions:
[
{
name: string ,
description: string ,
parameters: string ,
}
,
]
,
function_call: string ,
max_tokens: integer ,
temperature: number ,
top_p: number ,
logit_bias: object ,
user: string ,
n: integer ,
stop:
[
string ,
]
,
presence_penalty: number ,
frequency_penalty: number ,
stream: boolean ,
model: string ,
data_sources:
[
{
type: enum ,
}
,
]
,
enhancements:
{
grounding:
{
enabled: boolean ,
}
,
ocr:
{
enabled: boolean ,
}
,
}
,
seed: integer ,
logprobs: boolean ,
top_logprobs: integer ,
response_format:
{
type: string ,
}
,
tools:
[
{
type: string ,
}
,
]
,
tool_choice: string ,
}
,
}

⚐ Response (200)

{
id: string ,
created: integer ,
choices:
[
{
message:
{
role: enum ,
content: string ,
tool_calls:
[
{
type: string ,
id: string ,
}
,
]
,
function_call:
{
name: string ,
arguments: string ,
}
,
context:
{
citations:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
}
,
]
,
intent: string ,
}
,
}
,
logprobs: object ,
index: integer ,
finish_reason: enum ,
finish_details:
{
type: string ,
}
,
delta:
{
role: enum ,
content: string ,
tool_calls:
[
{
type: string ,
id: string ,
}
,
]
,
function_call:
{
name: string ,
arguments: string ,
}
,
context:
{
citations:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
}
,
]
,
intent: string ,
}
,
}
,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
protected_material_text:
{
filtered: boolean ,
detected: boolean ,
}
,
protected_material_code:
{
filtered: boolean ,
detected: boolean ,
URL: string ,
license: string ,
}
,
}
,
enhancements:
{
grounding:
{
lines:
[
{
text: string ,
spans:
[
{
text: string ,
offset: integer ,
length: integer ,
polygon:
[
{
x: number ,
y: number ,
}
,
]
,
}
,
]
,
}
,
]
,
}
,
}
,
}
,
]
,
model: string ,
prompt_filter_results:
[
{
prompt_index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
jailbreak:
{
filtered: boolean ,
detected: boolean ,
}
,
indirect_attack:
{
filtered: boolean ,
detected: boolean ,
}
,
}
,
}
,
]
,
system_fingerprint: string ,
usage:
{
completion_tokens: integer ,
prompt_tokens: integer ,
total_tokens: integer ,
}
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetCompletions (updated)
Description Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
Reference Link ¶

⚶ Changes

{
  "#id": "GetCompletions",
  "$responses": {
    "200": {
      "$properties": [
        {
          "#name": "usage",
          "Required": {
            "new": false,
            "old": true
          }
        }
      ]
    }
  }
}

⚼ Request

POST:  /deployments/{deploymentId}/completions
{
api-version: string ,
deploymentId: string ,
body:
{
prompt:
[
string ,
]
,
max_tokens: integer ,
temperature: number ,
top_p: number ,
logit_bias: object ,
user: string ,
n: integer ,
logprobs: integer ,
suffix: string ,
echo: boolean ,
stop:
[
string ,
]
,
presence_penalty: number ,
frequency_penalty: number ,
best_of: integer ,
stream: boolean ,
model: string ,
}
,
}

⚐ Response (200)

{
id: string ,
created: integer ,
prompt_filter_results:
[
{
prompt_index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
jailbreak:
{
filtered: boolean ,
detected: boolean ,
}
,
indirect_attack:
{
filtered: boolean ,
detected: boolean ,
}
,
}
,
}
,
]
,
choices:
[
{
text: string ,
index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
protected_material_text:
{
filtered: boolean ,
detected: boolean ,
}
,
protected_material_code:
{
filtered: boolean ,
detected: boolean ,
URL: string ,
license: string ,
}
,
}
,
logprobs: object ,
finish_reason: enum ,
}
,
]
,
usage:
{
completion_tokens: integer ,
prompt_tokens: integer ,
total_tokens: integer ,
}
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}